package com.itheima.method;

public class Demo3Method {
    public static void main(String[] args) {
        // System.out.println(print(9, 29));
        // 对于返回值类型为void的方法,不能打印调用
        print(10,50);
    }

    public static void print(int n, int m) {
        if (m < n) {
            System.out.println("输入数据不合理");
            return;
        }
        System.out.println(n+"到"+m+"之间的奇数为:");
        for (int i = n; i <= m; i++) {
            if (i % 2 != 0) {
                System.out.println(i);
            }
        }
    }
}
